<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for ./src/loaders/ocLazyLoad.loaders.common.js</title>
    <meta charset="utf-8">

    <link rel="stylesheet" href="../prettify.css">

    <link rel="stylesheet" href="../base.css">
    <style type='text/css'>
        div.coverage-summary .sorter {
            background-image: url(../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class="header medium">
    <h1>Code coverage report for <span class="entity">./src/loaders/ocLazyLoad.loaders.common.js</span></h1>
    <h2>
        
        Statements: <span class="metric">58.46% <small>(38 / 65)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Branches: <span class="metric">40.43% <small>(19 / 47)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Functions: <span class="metric">75% <small>(6 / 8)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Lines: <span class="metric">59.38% <small>(38 / 64)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
    </h2>
    <div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">./src/loaders\</a> &#187; ocLazyLoad.loaders.common.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
&nbsp;
(function (angular) {
    "use strict";
&nbsp;
    angular.module("oc.lazyLoad").config(function ($provide) {
        $provide.decorator("$ocLazyLoad", function ($delegate, $q, $window, $interval) {
            var uaCssChecked = false,
                useCssLoadPatch = false,
                anchor = $window.document.getElementsByTagName("head")[0] || <span class="branch-1 cbranch-no" title="branch not covered" >$window.document.getElementsByTagName("body")[0];</span>
&nbsp;
            /**
             * Load a js/css file
             * @param type
             * @param path
             * @param params
             * @returns promise
             */
            $delegate.buildElement = function buildElement(type, path, params) {
                var deferred = $q.defer(),
                    el,
                    loaded,
                    filesCache = $delegate.getFilesCache(),
                    cacheBuster = <span class="fstat-no" title="function not covered" >function cacheBuster(url) {</span>
<span class="cstat-no" title="statement not covered" >                    var dc = new Date().getTime();</span>
<span class="cstat-no" title="statement not covered" >                    if (url.indexOf("?") &gt;= 0) {</span>
<span class="cstat-no" title="statement not covered" >                        if (url.substring(0, url.length - 1) === "&amp;") {</span>
<span class="cstat-no" title="statement not covered" >                            return url + "_dc=" + dc;</span>
                        }
<span class="cstat-no" title="statement not covered" >                        return url + "&amp;_dc=" + dc;</span>
                    } else {
<span class="cstat-no" title="statement not covered" >                        return url + "?_dc=" + dc;</span>
                    }
                };
&nbsp;
                // Store the promise early so the file load can be detected by other parallel lazy loads
                // (ie: multiple routes on one page) a 'true' value isn't sufficient
                // as it causes false positive load results.
                <span class="missing-if-branch" title="else path not taken" >E</span>if (angular.isUndefined(filesCache.get(path))) {
                    filesCache.put(path, deferred.promise);
                }
&nbsp;
                // Switch in case more content types are added later
                switch (type) {
                    case "css":
                        el = $window.document.createElement("link");
                        el.type = "text/css";
                        el.rel = "stylesheet";
                        el.href = params.cache === false ? <span class="branch-0 cbranch-no" title="branch not covered" >cacheBuster(path) </span>: path;
                        break;
                    case "js":
                        el = $window.document.createElement("script");
                        el.src = params.cache === false ? <span class="branch-0 cbranch-no" title="branch not covered" >cacheBuster(path) </span>: path;
                        break;
<span class="branch-2 cbranch-no" title="branch not covered" >                    default:</span>
<span class="cstat-no" title="statement not covered" >                        deferred.reject(new Error("Requested type \"" + type + "\" is not known. Could not inject \"" + path + "\""));</span>
<span class="cstat-no" title="statement not covered" >                        break;</span>
                }
                el.onload = el.onreadystatechange = function (e) {
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (el.readyState &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >!/^c|loade/.test(el.readyState) </span>|| loaded) <span class="cstat-no" title="statement not covered" >return;</span>
                    el.onload = el.onreadystatechange = null;
                    loaded = 1;
                    $delegate.broadcast("ocLazyLoad.fileLoaded", path);
                    deferred.resolve();
                };
                el.onerror = function () {
                    deferred.reject(new Error("Unable to load " + path));
                };
                el.async = params.serie ? <span class="branch-0 cbranch-no" title="branch not covered" >0 </span>: 1;
&nbsp;
                var insertBeforeElem = anchor.lastChild;
                <span class="missing-if-branch" title="if path not taken" >I</span>if (params.insertBefore) {
<span class="cstat-no" title="statement not covered" >                    var element = angular.element(params.insertBefore);</span>
<span class="cstat-no" title="statement not covered" >                    if (element &amp;&amp; element.length &gt; 0) {</span>
<span class="cstat-no" title="statement not covered" >                        insertBeforeElem = element[0];</span>
                    }
                }
                anchor.insertBefore(el, insertBeforeElem);
&nbsp;
                /*
                 The event load or readystatechange doesn't fire in:
                 - iOS &lt; 6       (default mobile browser)
                 - Android &lt; 4.4 (default mobile browser)
                 - Safari &lt; 6    (desktop browser)
                 */
                if (type == "css") {
                    <span class="missing-if-branch" title="else path not taken" >E</span>if (!uaCssChecked) {
                        var ua = $window.navigator.userAgent.toLowerCase();
&nbsp;
                        // iOS &lt; 6
                        <span class="missing-if-branch" title="if path not taken" >I</span>if (/iP(hone|od|ad)/.test($window.navigator.platform)) {
<span class="cstat-no" title="statement not covered" >                            var v = $window.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);</span>
<span class="cstat-no" title="statement not covered" >                            var iOSVersion = parseFloat([parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)].join("."));</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = iOSVersion &lt; 6;</span>
                        } else <span class="missing-if-branch" title="if path not taken" >I</span>if (ua.indexOf("android") &gt; -1) {
                            // Android &lt; 4.4
<span class="cstat-no" title="statement not covered" >                            var androidVersion = parseFloat(ua.slice(ua.indexOf("android") + 8));</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = androidVersion &lt; 4.4;</span>
                        } else <span class="missing-if-branch" title="if path not taken" >I</span>if (ua.indexOf("safari") &gt; -1 &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >ua.indexOf("chrome") == -1 </span>&amp;&amp; <span class="branch-2 cbranch-no" title="branch not covered" >ua.indexOf("phantomjs") == -1)</span> {
<span class="cstat-no" title="statement not covered" >                            var safariVersion = parseFloat(ua.match(/version\/([\.\d]+)/i)[1]);</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = safariVersion &lt; 6;</span>
                        }
                    }
&nbsp;
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (useCssLoadPatch) {
<span class="cstat-no" title="statement not covered" >                        var tries = 1000; </span>// * 20 = 20000 miliseconds
<span class="cstat-no" title="statement not covered" >                        var interval = $interval(<span class="fstat-no" title="function not covered" >function () {</span></span>
<span class="cstat-no" title="statement not covered" >                            try {</span>
<span class="cstat-no" title="statement not covered" >                                el.sheet.cssRules;</span>
<span class="cstat-no" title="statement not covered" >                                $interval.cancel(interval);</span>
<span class="cstat-no" title="statement not covered" >                                el.onload();</span>
                            } catch (e) {
<span class="cstat-no" title="statement not covered" >                                if (--tries &lt;= 0) {</span>
<span class="cstat-no" title="statement not covered" >                                    el.onerror();</span>
                                }
                            }
                        }, 20);
                    }
                }
&nbsp;
                return deferred.promise;
            };
&nbsp;
            return $delegate;
        });
    });
})(angular);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkM6L3dhbXAvd3d3L29jTGF6eUxvYWQvc3JjL2xvYWRlcnMvb2NMYXp5TG9hZC5sb2FkZXJzLmNvbW1vbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLENBQUMsVUFBUyxPQUFPLEVBQUU7QUFDZixnQkFBWSxDQUFDOztBQUViLFdBQU8sQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFDLENBQUMsTUFBTSxDQUFDLFVBQVMsUUFBUSxFQUFFO0FBQ3BELGdCQUFRLENBQUMsU0FBUyxD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ge1xuICAgICAgICAgICAgICAgIHZhciBkZWZlcnJlZCA9ICRxLmRlZmVyKCksXG4gICAgICAgICAgICAgICAgICAgIGVsLFxuICAgICAgICAgICAgICAgICAgICBsb2FkZWQsXG4gICAgICAgICAgICAgICAgICAgIGZpbGVzQ2FjaGUgPSAkZGVsZWdhdGUuZ2V0RmlsZXNDYWNoZSgpLFxuICAgICAgICAgICAgICAgICAgICBjYWNoZUJ1c3RlciA9IGZ1bmN0aW9uIGNhY2hlQnVzdGVyKHVybCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRjID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZih1cmwuaW5kZXhPZignPycpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih1cmwuc3Vic3RyaW5nKDAsIHVybC5sZW5ndGggLSAxKSA9PT0gJyYnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyAnX2RjPScgKyBkYztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArICcmX2RjPScgKyBkYztcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArICc/X2RjPScgKyBkYztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgIC8vIFN0b3JlIHRoZSBwcm9taXNlIGVhcmx5IHNvIHRoZSBmaWxlIGxvYWQgY2FuIGJlIGRldGVjdGVkIGJ5IG90aGVyIHBhcmFsbGVsIGxhenkgbG9hZHNcbiAgICAgICAgICAgICAgICAvLyAoaWU6IG11bHRpcGxlIHJvdXRlcyBvbiBvbmUgcGFnZSkgYSAndHJ1ZScgdmFsdWUgaXNuJ3Qgc3VmZmljaWVudFxuICAgICAgICAgICAgICAgIC8vIGFzIGl0IGNhdXNlcyBmYWxzZSBwb3NpdGl2ZSBsb2FkIHJlc3VsdHMuXG4gICAgICAgICAgICAgICAgaWYoYW5ndWxhci5pc1VuZGVmaW5lZChmaWxlc0NhY2hlLmdldChwYXRoKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgZmlsZXNDYWNoZS5wdXQocGF0aCwgZGVmZXJyZWQucHJvbWlzZSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gU3dpdGNoIGluIGNhc2UgbW9yZSBjb250ZW50IHR5cGVzIGFyZSBhZGRlZCBsYXRlclxuICAgICAgICAgICAgICAgIHN3aXRjaCh0eXBlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Nzcyc6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbCA9ICR3aW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnbGluaycpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZWwudHlwZSA9ICd0ZXh0L2Nzcyc7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5yZWwgPSAnc3R5bGVzaGVldCc7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5ocmVmID0gcGFyYW1zLmNhY2hlID09PSBmYWxzZSA/IGNhY2hlQnVzdGVyKHBhdGgpIDogcGF0aDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdqcyc6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbCA9ICR3aW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5zcmMgPSBwYXJhbXMuY2FjaGUgPT09IGZhbHNlID8gY2FjaGVCdXN0ZXIocGF0aCkgOiBwYXRoO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QobmV3IEVycm9yKCdSZXF1ZXN0ZWQgdHlwZSBcIicgKyB0eXBlICsgJ1wiIGlzIG5vdCBrbm93bi4gQ291bGQgbm90IGluamVjdCBcIicgKyBwYXRoICsgJ1wiJykpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsLm9ubG9hZCA9IGVsWydvbnJlYWR5c3RhdGVjaGFuZ2UnXSA9IGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYoKGVsWydyZWFkeVN0YXRlJ10gJiYgISgvXmN8bG9hZGUvLnRlc3QoZWxbJ3JlYWR5U3RhdGUnXSkpKSB8fCBsb2FkZWQpIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgZWwub25sb2FkID0gZWxbJ29ucmVhZHlzdGF0ZWNoYW5nZSddID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgbG9hZGVkID0gMTtcbiAgICAgICAgICAgICAgICAgICAgJGRlbGVnYXRlLmJyb2FkY2FzdCgnb2NMYXp5TG9hZC5maWxlTG9hZGVkJywgcGF0aCk7XG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsLm9uZXJyb3IgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVqZWN0KG5ldyBFcnJvcignVW5hYmxlIHRvIGxvYWQgJyArIHBhdGgpKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsLmFzeW5jID0gcGFyYW1zLnNlcmllID8gMCA6IDE7XG5cbiAgICAgICAgICAgICAgICB2YXIgaW5zZXJ0QmVmb3JlRWxlbSA9IGFuY2hvci5sYXN0Q2hpbGQ7XG4gICAgICAgICAgICAgICAgaWYocGFyYW1zLmluc2VydEJlZm9yZSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGFuZ3VsYXIuZWxlbWVudChwYXJhbXMuaW5zZXJ0QmVmb3JlKTtcbiAgICAgICAgICAgICAgICAgICAgaWYoZWxlbWVudCAmJiBlbGVtZW50Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluc2VydEJlZm9yZUVsZW0gPSBlbGVtZW50WzBdO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGFuY2hvci5pbnNlcnRCZWZvcmUoZWwsIGluc2VydEJlZm9yZUVsZW0pO1xuXG4gICAgICAgICAgICAgICAgLypcbiAgICAgICAgICAgICAgICAgVGhlIGV2ZW50IGxvYWQgb3IgcmVhZHlzdGF0ZWNoYW5nZSBkb2Vzbid0IGZpcmUgaW46XG4gICAgICAgICAgICAgICAgIC0gaU9TIDwgNiAgICAgICAoZGVmYXVsdCBtb2JpbGUgYnJvd3NlcilcbiAgICAgICAgICAgICAgICAgLSBBbmRyb2lkIDwgNC40IChkZWZhdWx0IG1vYmlsZSBicm93c2VyKVxuICAgICAgICAgICAgICAgICAtIFNhZmFyaSA8IDYgICAgKGRlc2t0b3AgYnJvd3NlcilcbiAgICAgICAgICAgICAgICAgKi9cbiAgICAgICAgICAgICAgICBpZih0eXBlID09ICdjc3MnKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmKCF1YUNzc0NoZWNrZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1YSA9ICR3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBpT1MgPCA2XG4gICAgICAgICAgICAgICAgICAgICAgICBpZigvaVAoaG9uZXxvZHxhZCkvLnRlc3QoJHdpbmRvdy5uYXZpZ2F0b3IucGxhdGZvcm0pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSAoJHdpbmRvdy5uYXZpZ2F0b3IuYXBwVmVyc2lvbikubWF0Y2goL09TIChcXGQrKV8oXFxkKylfPyhcXGQrKT8vKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaU9TVmVyc2lvbiA9IHBhcnNlRmxvYXQoW3BhcnNlSW50KHZbMV0sIDEwKSwgcGFyc2VJbnQodlsyXSwgMTApLCBwYXJzZUludCh2WzNdIHx8IDAsIDEwKV0uam9pbignLicpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VDc3NMb2FkUGF0Y2ggPSBpT1NWZXJzaW9uIDwgNjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZih1YS5pbmRleE9mKFwiYW5kcm9pZFwiKSA+IC0xKSB7IC8vIEFuZHJvaWQgPCA0LjRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYW5kcm9pZFZlcnNpb24gPSBwYXJzZUZsb2F0KHVhLnNsaWNlKHVhLmluZGV4T2YoXCJhbmRyb2lkXCIpICsgOCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZUNzc0xvYWRQYXRjaCA9IGFuZHJvaWRWZXJzaW9uIDwgNC40O1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmKHVhLmluZGV4T2YoJ3NhZmFyaScpID4gLTEgJiYgdWEuaW5kZXhPZignY2hyb21lJykgPT0gLTEgJiYgdWEuaW5kZXhPZigncGhhbnRvbWpzJykgPT0gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc2FmYXJpVmVyc2lvbiA9IHBhcnNlRmxvYXQodWEubWF0Y2goL3ZlcnNpb25cXC8oW1xcLlxcZF0rKS9pKVsxXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlQ3NzTG9hZFBhdGNoID0gc2FmYXJpVmVyc2lvbiA8IDY7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBpZih1c2VDc3NMb2FkUGF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0cmllcyA9IDEwMDA7IC8vICogMjAgPSAyMDAwMCBtaWxpc2Vjb25kc1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGludGVydmFsID0gJGludGVydmFsKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsLnNoZWV0LmNzc1J1bGVzO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaW50ZXJ2YWwuY2FuY2VsKGludGVydmFsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWwub25sb2FkKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKC0tdHJpZXMgPD0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWwub25lcnJvcigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgMjApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICByZXR1cm4gJGRlbGVnYXRlO1xuICAgICAgICB9KVxuICAgIH0pXG5cbn0pKGFuZ3VsYXIpO1xuIl19</pre></td></tr>
</table></pre>

</div>
<div class="footer">
    <div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 12 2015 22:24:47 GMT+0100 (Paris, Madrid)</div>
</div>

<script src="../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>

<script src="../sorter.js"></script>
</body>
</html>
